<template>
  <div class="app-container">
    <el-form :inline="true" ref="ruleForm" :model="formInline" class="demo-form-inline" @keyup.enter.native="search">
      <el-form-item label="">
        <el-col :span="6">
          <el-form-item prop="dateType">
            <el-select v-model="formInline.dateType" placeholder="请选择时间类型">
              <el-option
                label="发放时间"
                value="0"
              ></el-option>
              <el-option
                label="领取时间"
                value="1"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="18">
          <el-form-item prop="time">
            <el-date-picker
              v-model="formInline.time"
              type="datetimerange"
              align="right"
              unlink-panels
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              value-format="yyyy-MM-dd HH:mm:ss"
              :default-time="['00:00:00', '23:59:59']"
              :picker-options="pickerWeekStep">
            </el-date-picker>
          </el-form-item>
        </el-col>
      </el-form-item>
      <el-form-item label="账户名" prop="username">
        <el-input v-model="formInline.username" placeholder="请输入账户名"></el-input>
      </el-form-item>
      <el-form-item label="奖励VIP等级" prop="vipLevel">
        <el-select v-model="formInline.vipLevel" placeholder="请选择奖励VIP等级">
          <el-option
            v-for="item in vipManage.VIP_LEVEL"
            :label="item.title"
            :key="item.value"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <!--<el-form-item label="单号" prop="oddNum">-->
        <!--<el-input v-model="formInline.oddNum" placeholder="请输入单号"></el-input>-->
      <!--</el-form-item>-->
      <el-form-item label="奖励类型" prop="awardType">
        <el-select v-model="formInline.awardType" placeholder="请选择奖励类型">
          <el-option
            v-for="item in vipManage.VIP_AWARD_TYPE"
            :label="item.title"
            :key="item.value"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="领取状态" prop="status">
        <el-select v-model="formInline.status" placeholder="请选择领取状态">
          <el-option
            v-for="item in vipManage.VIP_GET_STATUS"
            :label="item.title"
            :key="item.value"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
      <el-button @click="selfResetForm('ruleForm')">重置</el-button>
      <el-button v-if="roleCheck('awards-record-export')" type="primary" icon="el-icon-download" @click="clickExport" :loading="downLoading">导出</el-button>
    </el-form>
  </div>
</template>

<script>
import { form, pickerOption } from '@/build';

export default {
  name: 'form-filter',
  mixins: [form, pickerOption],
  props: {
    downLoading: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      formInline: {
        dateType: '0',
        time: [
          moment().format('YYYY-MM-DD 00:00:00'),
          moment().format('YYYY-MM-DD 23:59:59'),
        ],
        username: undefined,
        vipLevel: undefined,
        awardType: undefined,
        status: undefined,
        size: 20,
        page: 1,
      },
    };
  },
  methods: {
    clickExport() {
      this.$emit('on-export', this.formInline);
    },
    search() {
      this.$emit('on-filter', this.formInline);
    },
    selfResetForm(formName) {
      this.resetForm(formName);
    },
  },
  mounted() {
  },
};
</script>

<style lang="scss" scoped>

</style>
